<?php

namespace app\admin\validate;

use think\Validate;

class Attachment extends Validate
{
    protected $rule = [
        'abbr' => 'require|max:50',
        'description' => 'max:255',
        'sort_order' => 'integer',
        'is_del' => 'in:0,1',
        'image' => 'max:255',
        'id' => 'integer|gt:0',
        'sku' => 'max:255',
        'computing_unit' => 'max:5',
        'freight_tag' => 'max:1',
        'model' => 'max:2',
        'cname' => 'require|max:255',
        'code' => 'require|max:255',
        'condition' => 'require|in:0,1',
        'status' => 'require|in:0,1',
        'power' => 'integer|egt:0',
        'weight' => 'float|egt:0',
        'gross_weight' => 'float|egt:0',
        'transport_weight' => 'float|egt:0',
        'dimensions' => 'float|egt:0',
        'gross_dimensions' => 'float|egt:0',
        'volume' => 'float|egt:0',
        'hashrate' => 'float|egt:0',
        'billing_weight' => 'float|egt:0',
        'advance_ratio' => 'float|egt:0',
        'expiration_date' => 'float|egt:0'
    ];

    protected $scene = [
        'search' => ['name' => 'max:255'],
        'delete' => ['ids' => 'require|array|checkIds'],
        'show' => ['id' => 'require'],
        'save' => ['cname', 'description', 'image', 'gross_weight', 'expiration_date', 'gross_dimensions', 'sales_price'],
        'create' => ['cname', 'description', 'image',  'gross_weight', 'expiration_date', 'gross_dimensions', 'sales_price'],
    ];
}
